using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BUS;
namespace QuanLyThuVien
{
    public partial class ThongTinSach : Form
    {
        public ThongTinSach()
        {
            InitializeComponent();
        }

        private void ThongTinSach_Load(object sender, EventArgs e)
        {
            DataTable dt_sach = SachBUS.LayTatCaSach_BUS();
            dgvSach.DataSource = dt_sach;

            DataTable dt_tinhTrang = TinhTrangBUS.LayTatCaTinhTrang_BUS();
            cmbTinhTrang.DataSource = dt_tinhTrang;
            cmbTinhTrang.DisplayMember = "TenTinhTrang";
            cmbTinhTrang.ValueMember = "MaTinhTrang";

            dtpNgayNhap.Value = DateTime.Today;

            DataTable dt_LoaiSach = LoaiSachBUS.LayTatCaTheLoai_BUS();
            cmbTheLoai.DataSource = dt_LoaiSach;
            cmbTheLoai.DisplayMember = "TenLoaiSach";
            cmbTheLoai.ValueMember = "MaTheLoaiSach";
           
           
        }

        private void dgvSach_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvSach.SelectedRows.Count > 0)
            {
                txtmasach.Text = dgvSach.SelectedRows[0].Cells[1].Value.ToString();
                
              //  cmbTheLoai.SelectedIndex =int.Parse( dgvSach.SelectedRows[0].Cells[1].Value.ToString());

                txtTenSach.Text = dgvSach.SelectedRows[0].Cells[2].Value.ToString();
            }
        }

       
    }
}